package com.sybil.ot.dao;

import com.sybil.ot.dominio.Planta;
import java.util.List;
import org.hibernate.Criteria;
import org.hibernate.criterion.Order;
import org.hibernate.criterion.Restrictions;
import org.springframework.stereotype.Repository;

@Repository("plantaDAO")
public class PlantaDAO extends AbstractDAO<Planta, String> {

   public PlantaDAO() {
      super(Planta.class);
   }

   public List<Planta> obtenerPlantas() {
      Criteria c = sesionActual().createCriteria(Planta.class);
      c.add(Restrictions.ne("tipo", "A"))
      .add(Restrictions.eq("activo", "S"))
      .addOrder(Order.asc("clave")).addOrder(Order.asc("descripcion"));
      return c.list();
   }

   public Planta obtenerPlanta(String clave) {
      return obtener(clave);
   }
}
